package supermemo.dictcn;
import org.dom4j.Element;

/*
 *
 * Copyright (c) 2004-2010.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY ARIZONA STATE UNIVERSITY ``AS IS'' AND
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ARIZONA STATE UNIVERSITY
 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

/**
 * @author <a href='mailto:Yan.Qi@asu.edu'>Yan Qi</a>
 * @version $Revision: 14 $
 * @latest $Id: EngWord.java 14 2010-05-22 08:05:46Z yan.qi.asu $
 */
public class EngWord
{
	private String word = "";
	private String pron = "";
	private String explanation = "";
	private String timestamp = "";
	private int level = 1;
	
	public EngWord(final Element word_elm)
	{
		word = word_elm.selectSingleNode("word").getText();
		pron = word_elm.selectSingleNode("pron").getText();
		explanation = word_elm.selectSingleNode("description").getText();
		timestamp = word_elm.selectSingleNode("time").getText();
		level = Integer.parseInt(word_elm.selectSingleNode("level").getText());
	}
	
	public String toString()
	{
		return word;
	}
	
	public String getWord()
	{
		return word;
	}
	
	public String getDescription()
	{
		return "["+pron+"] "+explanation+"; \n Added at "+timestamp+" \n Level: "+level;
	}
	
	public String getTimeStamp()
	{
		return timestamp;
	}
}
